import Ember from 'ember';

export default Ember.Component.extend({
  nodes: Ember.computed('model', function(){
    var node = this.get('model'),
      nodes = [node],
      idx,
      rnodes = [];

      node = node.get('p');
    while(node) {
      nodes.push(node);
      node = node.get('p');
    }

    idx = nodes.length - 1;

    for(; idx > -1; idx--) {
      rnodes.push(nodes[idx]);
    }
    return rnodes;
  }),
  actions: {
    breadNodeClicked(node) {
      this.sendAction('action', node);
    }
  }
});
